package shm;

import org.apache.tomcat.jni.Library;
import org.apache.tomcat.jni.Pool;
import org.apache.tomcat.jni.Stdlib;

/**
 * License: Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
 * <p/>
 * Author: Ashwin Jayaprakash
 * <p/>
 * Email: ashwin.jayaprakash@gmail.com
 * <p/>
 * Web: http://www.ashwinjayaprakash.com
 */
public class SlibTest {
    public static void main(String[] args) throws Exception {
        Library.initialize(null);
        System.out.println("This pid: " + Stdlib.getpid());

        long poolH = Pool.create(0);

        //long procH = launchChildProcess(poolH, "calc.exe", null, null, "C:\\Windows\\system32");
        //long procH = launchChildProcess(poolH, "elasticsearch.bat", null, null, "C:\\_Dump_\\elasticsearch-0.17.5\\bin");
        long procH = ProcCommon.launchChildProcess(poolH, "java",
                new String[]{"", "-jar", "FileChooserDemo.jar"}, null,
                "C:\\Programs1\\Java\\jdk1.7.0\\demo\\jfc\\FileChooserDemo");

        System.out.println("Child pid: " + procH);

        ProcCommon.waitForChildProcess(procH);

        System.out.println("Press any key to exit...");
        System.in.read();
    }
}
